#!/usr/bin/env python

PACKAGE = "whu_controller"

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

这里参数设置第一个数是默认值，第二个和第三个是最小最大
v9=gen.add_group("v9", type="tab")

v9.add("Vcmd",double_t, 0, "m/s", 1.0, 0.0, 10.0)                                 目标速度的最大值
v9.add("turnVcmd",double_t, 0, "m/s", 1.0, 0.0, 10.0)                                    
v9.add("baseAngle",double_t, 0, "the middle pos of servo", 90, 0, 180)        前轮正中的舵机pwm
v9.add("AngleGain",double_t, 0, "Angle Gain", -1.2, -5, 5)                              
v9.add("SPEED_CONTROL_P",double_t, 0, "basereverse",0.0, 0.0,1000000.0)       速度控制的p
v9.add("SPEED_CONTROL_I",double_t, 0, "basereverse",0.0, 0.0,1000000.0)     速度控制的I
v9.add("SPEED_CONTROL_D",double_t, 0, "basereverse",0.0, 0.0,1000000.0)     速度控制的D
v9.add("SPEED_CONTROL_P_BK",double_t, 0, "basereverse",0.0, 0.0,1000000.0)       减速时采用更大的P，刹车更猛



whuLfw = gen.add_group("whuLfw", type="tab")
whuLfw.add("strOrCurve",double_t, 0, "boundaries of straight and curve line(rad)",0.14, 0.0,4.0)          这几个参数好像是算动态前瞻的，一般不改
whuLfw.add("angleCeil",double_t, 0, "angle ceiling(rad)",0.35, 0.0,4.0)        
whuLfw.add("curLfw",double_t, 0, "curve line",0.6, 0.0,4.0)
whuLfw.add("strLfw",double_t, 0, "stright line",1.5, 0.0,4.0)

changgui=gen.add_group("changgui", type="tab")
changgui.add("baseSpeed",int_t, 0, "expected volecity(open loop),unit:ms", 1600, 1300, 1800)               （这几个pwm我不太记得了，好像是是开环的参数）启动时电机pwm    
changgui.add("deadSpeed",int_t, 0, "dead zone volecity(open loop),unit:ms", 1560, 1300, 1800)           停车电机pwm
changgui.add("turnSpeed",int_t, 0, "turning volecity(open loop),unit:ms", 1572, 1300, 1800)              转弯pwm
changgui.add("backSpeed",int_t, 0, "back volecity(open loop),unit:ms", 1290, 1290, 1800)              倒车pwm
changgui.add("AngleGainBack",double_t, 0, "Angle Gain", -1.2, -5, 5)            角度增益，舵机打角总是偏小，在用自行车模型算出目标打角后再乘个倍数，之后再计算pwm
changgui.add("Lfw",double_t, 0, "lookfoward",0.7, 0.0,10.0)                 好像是向前走最大前瞻
changgui.add("Lrv",double_t, 0, "lookreverse",0.8, 0.0,10.0)                    转弯前瞻
changgui.add("lrv",double_t, 0, "basereverse",0.13, 0.0,10.0)           好像是倒车前瞻（一般不用）


exit(gen.generate(PACKAGE, "whu_controller","art_car_controller"))